﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Xpo;
using DevExpress.Data.Filtering;
using DevExpress.ExpressApp;
using System.Reflection;

namespace DllModule.DomainObject
{
    
    public class DomainObject : BaseObject
    {
        public DomainObject(Session session)
            : base(session)
        {

        }
        private string _A;
        [Custom("Caption", "A")]
        public string A
        {
            get { return _A; }
            set { SetPropertyValue<string>("A", ref _A, value); }
        }
        private string _B;
        [Custom("Caption", "B")]
        public string B
        {
            get { return _B; }
            set { SetPropertyValue<string>("B", ref _B, value); }
        }
        private string _C;
        [Custom("Caption", "C")]
        public string C
        {
            get { return _C; }
            set { SetPropertyValue<string>("C", ref _C, value); }
        }
    }
    public class Oper
    {
        public Oper()
        {

        }
        public DomainObject CreateObject(IObjectSpace os)
        {
            DomainObject d = os.CreateObject<DomainObject>();
            return d;
            //d.A = "aaa";
            //d.B = "bbb" + DateTime.Now;
            //d.Save();
        }
        public static DomainObject GetData(IObjectSpace os)
        {
            DomainObject d = os.CreateObject<DomainObject>();
            return d;
            //DomainObject d = os.FindObject<DomainObject>(CriteriaOperator.Parse("A=?", "aaa"));
            //if (d != null)
            //{
            //    return d.B;
            //}
            //else
            //{
            //    return "null";
            //}
        }
    }
}
